package com.ming.demo.easyiot;

import android.support.annotation.NonNull;

/**
 * Created by YuMing on 2016/4/21.
 * 该类用于字符判断
 */
public class StringUtil {

    /**
     *
     * 该方法用于对字符常进行判空
     * @param str 需判断的字符串
     * @return boolean类型值，字符为空或者str为null字符时均判定为空返回true
     *
     */
    public static boolean isNull(@NonNull String str){
        if (null == str || str.length() == 0 || ("".equals(str)) ||("0".equals(str))|| " ".equalsIgnoreCase(str)
                || "null".equalsIgnoreCase(str)){
            return true;
        }else {
            return false;
        }
    }
    public static String resetStrNull(@NonNull String str){
        if (null == str || str.length() == 0 || ("".equals(str)) || " ".equalsIgnoreCase(str) ){
            return "";
        }else {
            return str;
        }
    }

}
